package leetcode.tree;

import leetcode.tree.common.TreeNode;
import leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution270 {
    public int closestValue(TreeNode root, double target) {
        return TreeUtils.closestValue(root, target);
    }
}

public class leetcode270 {
    public static void main(String[] args) {
        Solution270 solution270 = new Solution270();
        Integer[] root = {4, 2, 5, 1, 3};
        Integer[] root1 = {2, 1, 3};
//        System.out.println(solution270.closestValue(TreeUtils.generateLeetcodeTree(root), 3.714286));
        System.out.println(solution270.closestValue(TreeUtils.generateLeetcodeTree(root1), 0.142857));
    }
}
